home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
hypercrd
/
hc2_x
/
tcprogud.sit
/
TC Prog Guide
/
card_29372.txt
< prev
next >
Wrap
Text File
|
1991-02-27
|
2KB
|
107 lines
-- card: 29372 from stack: in
-- bmap block id: 0
-- flags: 0000
-- background id: 4755
-- name:
-- part 1 (field)
-- low flags: 00
-- high flags: 0007
-- rect: left=30 top=78 right=296 bottom=478
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 4
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
-- part 3 (button)
-- low flags: 00
-- high flags: 0001
-- rect: left=13 top=29 right=57 bottom=351
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: New Button
-- part contents for card part 1
----- text -----
/*
* FILE: person.c
* AUTHOR: R.G.
* CREATED: June 4, 1990
*
* Think C program illustrating use of the Person class.
*
* PROJECT CONTENTS:
* person.c, ANSI, oops libraries
*/
# include <oops.h>
# include <stdio.h>
/******************************************************************
* Definition of Person class and its methods
******************************************************************/
struct Person:indirect
{
int age;
int weight;
void set(void);
void print(void);
};
void Person::set(void)
{
int new_age,
new_weight;
printf("Enter age and weight separated by spaces:\n");
scanf("%d %d",&new_age,&new_weight);
age = new_age;
weight = new_weight;
}
void Person::print(void)
{
printf("My age is %d\n",age);
printf("My weight is %d\n",weight);
}
/******************************************************************
* main() function
******************************************************************/
main()
{
Person *person;
person = new(Person);
person->set();
person->print();
delete(person);
}
-- part contents for background part 6
----- text -----
Simple Person class example
-- part contents for background part 4
----- text -----
A complete TC program using the Person class:
-- part contents for background part 7
----- text -----
17